/* 
 * File:   Challenge.h
 * Author: Denys Knertser
 *
 * Created on February 14, 2012, 2:16 PM
 */
#include "PacketFormat.h"
#include <string>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>

#ifndef CHALLENGE_H
#define	CHALLENGE_H

class Challenge: public PacketFormat {
public:
    Challenge();
    Challenge(std::string /*client_challenge_packet*/);
    std::string getChallenge();
private:
    char value_size;
    std::string value;
    std::string name;
    int generateChallengeValue(); //generate random 16 bytes string, put them into "value" variable
    int serverAuthResponse(); //decrypt client challenge using server private key and put it into "name" variable
    int setIdentifier(); // read the previously used identifier value, increments it and puts a new value into file
};

#endif	/* CHALLENGE_H */

